<?php
session_start();


?>

<html>
    <head>
        <link rel="stylesheet" href="style/style.css" />

	<script type="text/javascript" src="script/validator.js"></script>
	<script type="text/javascript" src="script/calendar.js"></script>
	<script type="text/javascript" src="script/ajax.js"></script>
    <script type="text/javascript" src="script/gallery.js"></script>        
		<?php
        if (isset($_GET['view']) && $_GET['view']==2) {
			if (!isset($_GET['UserTujuan'])) {
				if (!isset($_GET['usr_tag'])) {
				?>
				<script type="text/javascript">
					   document.getElementById("content").innerHTML = viewPhoto('<?php echo $_GET['photo_id'];?>', null, null);
				</script>
				<?php
				} else {
				// liat tag orang
				?>
				<script type="text/javascript">
					   document.getElementById("content").innerHTML = viewPhoto('<?php echo $_GET['photo_id'];?>', null, '<?php echo $_GET['usr_tag'];?>');
				</script>
				<?php
				}
			} else {
				if (!isset($_GET['usr_tag'])) {
				?>
				<script type="text/javascript">
                       document.getElementById("content").innerHTML = viewPhoto('<?php echo $_GET['photo_id'];?>', '<?php echo $_GET['UserTujuan'];?>', null);
                </script>
                <?php
				} else {
				?>
				<script type="text/javascript">
                       document.getElementById("content").innerHTML = viewPhoto('<?php echo $_GET['photo_id'];?>', '<?php echo $_GET['UserTujuan'];?>', '<?php echo $_GET['usr_tag'];?>');
                </script>
				<?php
				}
			}
		} else if (isset($_GET['view']) && $_GET['view']==1) {
			?>
			<script type="text/javascript">
                   document.getElementById("content").innerHTML = viewGallery('<?php echo $_GET['UserTujuan'];?>');
            </script>
            <?php
		} else if (isset($_GET['edit']) && isset($_GET['photo_id'])) {
			?>
			<script type="text/javascript">
                   document.getElementById("content").innerHTML = viewEditPhoto('<?php echo $_GET['photo_id'];?>');
            </script>
            <?php
		} else if (!isset($_GET['prof'])){
        ?>
        <script type="text/javascript">
        
            //setInterval('viewHome()',3000);
            document.getElementById("content").innerHTML = viewHome();

            

        </script>
        <?php
           }
           else if (isset($_GET['prof']) && $_GET['prof'] == "edit_follower"){
           // header("Location: javascript:viewProfile();");
            ?>
            <script type="text/javascript">
                    document.getElementById("content").innerHTML = viewEditFollower();
                </script>
            <?php
           }
           else if (isset($_GET['prof']) && $_GET['prof'] == "edit_following"){
           // header("Location: javascript:viewProfile();");
            ?>
            <script type="text/javascript">
                    document.getElementById("content").innerHTML = viewEditFollowing();
                </script>
            <?php
           }

           if (isset($_GET['msgsucc']) && $_GET['msgsucc'] == 1){
                ?>
            <script type="text/javascript">
                    document.getElementById("content").innerHTML = viewMessage();
                </script>
            <?php
           }

           if (isset($_GET['replymsg']) && $_GET['replymsg'] == 1){
                ?>
            <script type="text/javascript">
                    document.getElementById("content").innerHTML = viewMessageThread(<?php echo $_GET['msgid']; ?>,'<?php echo $_GET['sub'];?>');
                </script>
            <?php
           }
		
		?>

    </head>
    <body onLoad="loadPageHide()" >
        
        <div id="container">
        <div id="headerBody">
            <form id="Search" name="Search" method ="GET" action="search_result.php">

                <input type="text" id="SearchBar" name="SearchBar"/>

                <input type="submit" id="SearchOk" name="SearchOk" value="Search"/>
            </form>
            <?php if ($_SESSION['Username'] != null) {
            ?>
                <a id="headerLink" href="javascript:viewHome();" id="headerLink">Home</a>
                <a id="headerLink" href="javascript:showPopupProfile();" id="headerLink">Profile</a>
                <a id="headerLink" href="javascript:viewMessage();" id="headerLink">Message</a>
                <a id="headerLink" href="javascript:viewUploader();" id="headerLink">Uploader</a>
                <a id="headerLink" href="javascript:viewGallery();" id="headerLink">Gallery</a>
                <a href="database/login.php?logout=1" id="logout_link" >Logout</a>
                <a href="chat.php" id="logout_link" >Chat</a>
                <a href="javascript:viewProfile();" id="logout_link" ><?php echo $_SESSION['Username'];?></a>

                
                <a href="javascript:showNotif('<?php echo $_SESSION['Username']; ?>');" id="headerLink">Notification</a>

                <!-- tampilin jumlah notif -->
                <script type="text/javascript">
                </script>
                <span id="notif_number">
            
                </span>
                <div id="profile_popup">
                </div>
                <div id="notif">
                    <div id="notif2">
                    </div>
                </div>
                <a href="profile.php" id="logout_link" ><?php echo $u; ?></a>
            <?php } else { ?>
                <a href="index.php" id="logout_link" >Login</a>
            <?php
            }
            ?>
        </div>
        <div id=""><img src="images/flickertiew_logo.gif" alt=""/></div>
        <!-- CONTENT dimulai disini -->
        <div id="centerBody">
        <div id ="content">

            
        </div>
        </div>
        <div id="footerBody" class="group_content">
                <div id="footer" align="center">
                    Copyright &copy; 2011<br/>
                    Created by <a href="http://www.facebook.com/Gunawan.Robert" id="headerLink">Robert Gunawan</a>
                                                    , <a href="http://www.facebook.com/danz3m" id="headerLink">Danang Tri Massandy</a>,
                    <a href="http://www.facebook.com/achmad.giovani" id="headerLink">Achmad Giovani</a>
                </div>
            </div> 
        </div>
        
        
    </body>

</html>